// Copyright (C) <2018> Zealcomm Inc.
//
// SPDX-License-Identifier: Apache-2.0
#ifndef IRTC_BASE_OBJC_IRTCMEDIAFORMAT_H_
#define IRTC_BASE_OBJC_IRTCMEDIAFORMAT_H_

#import <AVFoundation/AVFoundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/Foundation.h>
#import <IRTC/IRTCMacros.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, IRTCAudioCodec) {
  IRTCAudioCodecPcmu = 1,
  IRTCAudioCodecPcma = 2,
  IRTCAudioCodecOpus = 3,
  IRTCAudioCodecG722 = 4,
  IRTCAudioCodecIsac = 5,
  IRTCAudioCodecIlbc = 6,
  IRTCAudioCodecAac = 7,
  IRTCAudioCodecAc3 = 8,
  IRTCAudioCodecAsao = 9,
  IRTCAudioCodecUnknown = 10,
};
typedef NS_ENUM(NSInteger, IRTCVideoCodec) {
  IRTCVideoCodecVP8 = 1,
  IRTCVideoCodecVP9 = 2,
  IRTCVideoCodecH264 = 3,
  IRTCVideoCodecH265 = 4,
  IRTCVideoCodecUnknown = 5,
};
typedef NS_ENUM(NSInteger, IRTCAudioSourceInfo) {
  IRTCAudioSourceInfoMic = 1,
  IRTCAudioSourceInfoScreenCast = 2,
  IRTCAudioSourceInfoFile = 3,
  IRTCAudioSourceInfoMixed = 4,
  IRTCAudioSourceInfoUnknown = 5,
};
typedef NS_ENUM(NSInteger, IRTCVideoSourceInfo) {
  IRTCVideoSourceInfoCamera = 1,
  IRTCVideoSourceInfoScreenCast = 2,
  IRTCVideoSourceInfoFile = 3,
  IRTCVideoSourceInfoMixed = 4,
  IRTCVideoSourceInfoUnknown = 5,
};
typedef NS_OPTIONS(NSInteger, IRTCTrackKind) {
  IRTCTrackKindUnknown = 0,
  IRTCTrackKindAudio = 1 << 0,
  IRTCTrackKindVideo = 1 << 1,
};

/// Media track status.<br>媒体轨道状态。
///
/// This enumeration defines status of media
/// track.<br>此枚举类型定义了媒体轨道状态。
typedef NS_ENUM(NSInteger, IRTCMediaTrackStatus) {
  IRTCMediaTrackActive = 1,    ///< active<br>活跃
  IRTCMediaTrackInactive = 2,  ///< inactive<br>非活跃
  IRTCMediaTrackFalse = 3,     ///< false<br>无效
  IRTCMediaTrackUnknown = 4,
};

/// Stream update field.<br>媒体流更新字段。
///
/// This enumeration defines field of stream
/// field.<br>此枚举类型定义了媒体流更新字段。
typedef NS_ENUM(NSInteger, IRTCStreamUpdateField) {
  IRTCMediaAudioStatus = 1,  ///< audio status<br>音频状态
  IRTCMediaVideoStatus = 2,  ///< video status<br>视频状态
  IRTCUnknown = 3,
};

/// Codec parameters for an audio track.<br>音频轨的编码参数。
IRTC_OBJC_EXPORT
@interface IRTCAudioCodecParameters : NSObject
/**
 @brief Name of a codec.<br>音频编码的名字。
 @details some functions do not support all the values in
 IRTCAudioCodec.<br>有些函数并不支持IRTCAudioCodec里的所有值。
*/
@property(nonatomic, assign) IRTCAudioCodec name;
/// Numbers of channels for an audio track.<br>音频轨的声道数量。
@property(nonatomic, assign) NSUInteger channelCount;
/// The codec clock rate expressed in Hertz.<br>编码时钟频率（Hertz）。
@property(nonatomic, assign) NSUInteger clockRate;
@end
/// Codec parameters for a video track.<br>视频轨的编码参数
IRTC_OBJC_EXPORT
@interface IRTCVideoCodecParameters : NSObject
/**
 @brief Name of a codec.<br>视频编码的名字。
 @details some functions do not support all the values in
 IRTCVideoCodec.<br>有些函数并不支持IRTCVideoCodec里的所有值。
*/
@property(nonatomic, assign) IRTCVideoCodec name;
/**
 @brief The profile of a codec.<br>视频编码的标准。
 @details Profile may not apply to all codecs.<br>编码标准并不适用于所有编码。
*/
@property(nonatomic, strong) NSString* profile;
@end
/// The audio settings of a publication.<br>一个发布的音频设置。
IRTC_OBJC_EXPORT
@interface IRTCAudioPublicationSettings : NSObject
@property(nonatomic, strong) IRTCAudioCodecParameters* codec;
@end
/// The video settings of a publication.<br>一个发布的视频设置。
IRTC_OBJC_EXPORT
@interface IRTCVideoPublicationSettings : NSObject
@property(nonatomic, strong) IRTCVideoCodecParameters* codec;
@property(nonatomic, assign) CGSize resolution;
@property(nonatomic, assign) CGFloat frameRate;
@property(nonatomic, assign) NSUInteger bitrate;
@property(nonatomic, assign) NSUInteger keyframeInterval;
@end
/// The settings of a publication.<br>一个发布的设置参数。
IRTC_OBJC_EXPORT
@interface IRTCPublicationSettings : NSObject
@property(nonatomic, strong) NSArray<IRTCAudioPublicationSettings*>* audio;
@property(nonatomic, strong) NSArray<IRTCVideoPublicationSettings*>* video;
@end
/// Represents the audio capability for subscription.<br>代表订阅的音频能力。
IRTC_OBJC_EXPORT
@interface IRTCAudioSubscriptionCapabilities : NSObject
@property(nonatomic, strong) NSArray<IRTCAudioCodecParameters*>* codecs;
@end
/// Represents the video capability for subscription.<br>代表订阅的视频能力。
IRTC_OBJC_EXPORT
@interface IRTCVideoSubscriptionCapabilities : NSObject
@property(nonatomic, strong) NSArray<IRTCVideoCodecParameters*>* codecs;
@property(nonatomic, strong) NSArray<NSValue*>* resolutions;
@property(nonatomic, strong) NSArray<NSNumber*>* frameRates;
@property(nonatomic, strong) NSArray<NSNumber*>* bitrateMultipliers;
@property(nonatomic, strong) NSArray<NSNumber*>* keyframeIntervals;
@end
/// Represents the capability for subscription.<br>代表订阅的能力。
IRTC_OBJC_EXPORT
@interface IRTCSubscriptionCapabilities : NSObject
@property(nonatomic, strong) IRTCAudioSubscriptionCapabilities* audio;
@property(nonatomic, strong) IRTCVideoSubscriptionCapabilities* video;
@end

/// Stream audio source info.<br>媒体音频流源信息。
IRTC_OBJC_EXPORT
@interface IRTCStreamAudioInfo : NSObject
/// The audio source info of the stream<br>媒体流的音频源信息。
@property(nonatomic, assign) IRTCAudioSourceInfo source;
/// The audio status of the stream<br>媒体流的音频源状态。
@property(nonatomic, assign) IRTCMediaTrackStatus status;
@end

/// Stream video source info.<br>媒体视频流源信息。
IRTC_OBJC_EXPORT
@interface IRTCStreamVideoInfo : NSObject
/// The video source info of the stream<br>媒体流的视频源信息。
@property(nonatomic, assign) IRTCVideoSourceInfo source;
/// The video status of the stream<br>媒体流的视频源状态。
@property(nonatomic, assign) IRTCMediaTrackStatus status;
@end

/// Information of a stream's source.<br>媒体源的信息。
IRTC_OBJC_EXPORT
@interface IRTCStreamMediaInfo : NSObject
@property(nonatomic, strong) IRTCStreamAudioInfo* audio;
@property(nonatomic, strong) IRTCStreamVideoInfo* video;
@end
IRTC_OBJC_EXPORT
/// Constraints for creating a video
/// MediaStreamTrack.<br>创建视频媒体流轨的配置参数。
@interface IRTCVideoTrackConstraints : NSObject
@property(nonatomic, assign) double frameRate;
@property(nonatomic, assign) CGSize resolution;
@property(nonatomic, assign) AVCaptureDevicePosition devicePosition;
@end
/// Constraints for creating a MediaStream from screen mic and
/// camera.<br>从屏幕麦克风和摄像头创建媒体流的配置参数。
IRTC_OBJC_EXPORT
@interface IRTCStreamConstraints : NSObject
/**
  @brief Indicate whether audio track is
  enabled.<br>这个参数说明是否启用音频轨。
  @details If audio is true, MediaStream created with this constraints object
  will capture audio from mic. Otherwise, audio will be
  disabled.<br>如果启用音频轨，用这个参数创建的MediaStream会使用麦克风采集音频。否则，音频轨不会被使用。
 */
@property(nonatomic, assign) BOOL audio;
/// Constraints for video track.<br>视频轨的配置参数。
@property(nonatomic, strong, nullable) IRTCVideoTrackConstraints* video;

/// Set whether support replace audio or video
/// source.<br>设置是否支持音视频源的替换。
@property(nonatomic, assign) BOOL upgradeable;
- (instancetype)init;
@end
/// Constraints for creating a MediaStream from screen mic and
/// camera.<br>从屏幕麦克风和摄像头创建媒体流的配置参数。
IRTC_OBJC_EXPORT
@interface IRTCShareAppConstraints : NSObject
/**
  @brief Indicate whether audio track is
  enabled.<br>这个参数说明是否启用音频轨。
  @details If audio is true, MediaStream created with this constraints object
  will capture audio from os. Otherwise, audio will be
  disabled.<br>如果启用音频轨，用这个参数创建的MediaStream会使用系统声音。否则，音频轨不会被使用。
 */
@property(nonatomic, assign) BOOL audio;
/**
  @brief Indicate whether audio track is
  enabled.<br>这个参数说明是否启用视频轨。
  @details If video is true, MediaStream created with this constraints object
  will capture screen from os. Otherwise, audio will be
  disabled.<br>如果启用视频轨，用这个参数创建的MediaStream会使用系统屏幕。否则，视频轨不会被使用。
 */
@property(nonatomic, assign) BOOL video;

/// Set whether support replace audio or video
/// source.<br>设置是否支持音视频源的替换。
@property(nonatomic, assign) BOOL upgradeable;
- (instancetype)init;
@end

/// Constraints for creating a MediaStream from screen mic and
/// camera.<br>从屏幕麦克风和摄像头创建媒体流的配置参数。
IRTC_OBJC_EXPORT
@interface IRTCShareScreenConstraints : NSObject
/**
  @brief Indicate whether audio track is
  enabled.<br>这个参数说明是否启用音频轨。
  @details If audio is true, MediaStream created with this constraints object
  will capture audio from os. Otherwise, audio will be
  disabled.<br>如果启用音频轨，用这个参数创建的MediaStream会使用系统声音。否则，音频轨不会被使用。
 */
@property(nonatomic, assign) BOOL audio;
/**
  @brief Indicate whether audio track is
  enabled.<br>这个参数说明是否启用视频轨。
  @details If video is true, MediaStream created with this constraints object
  will capture screen from os. Otherwise, audio will be
  disabled.<br>如果启用视频轨，用这个参数创建的MediaStream会使用系统屏幕。否则，视频轨不会被使用。
 */
@property(nonatomic, assign) BOOL video;

/// Set whether support replace audio or video
/// source.<br>设置是否支持音视频源的替换。
@property(nonatomic, assign) BOOL upgradeable;
- (instancetype)init;
@end

IRTC_OBJC_EXPORT
/// Encoding parameters for sending an audio track.<br>发送音频轨时的编码参数。
@interface IRTCAudioEncodingParameters : NSObject
@property(nonatomic, strong) IRTCAudioCodecParameters* codec;
/// Max bitrate expressed in bps.<br>音频媒体流的最大码率(bps)。
@property(nonatomic, assign) NSUInteger maxBitrate;
@end
IRTC_OBJC_EXPORT
/// Encoding parameters for sending a video track.<br>发送视频轨时的编码参数。
@interface IRTCVideoEncodingParameters : NSObject
@property(nonatomic, strong) IRTCVideoCodecParameters* codec;
/// Max bitrate expressed in bps.<br>视频媒体流的最大码率(bps)。
@property(nonatomic, assign) NSUInteger maxBitrate;
@end

/// Status about a connection quality.'.<br>连接的质量状态。
///
/// This enumeration defines status of connection
/// quality.<br>此枚举类型定义了连接的质量状态。
typedef NS_ENUM(NSInteger, IRTCQualityStatus) {
  IRTCQualityStatusGood = 1,  ///< good<br>好
  IRTCQualityStatusBad = 2,   ///< bad<br>坏
};

/// Class IRTCQualityInfo represents a quality info of
/// connection.<br>IRTCQualityInfo代表了一个连接的网络质量信息。
IRTC_OBJC_EXPORT
@interface IRTCQualityInfo : NSObject
/// Packet loss rate. Values: 0-100.<br>丢包率。取值可以是：0-100。
@property(nonatomic, assign) NSUInteger packetloss;
/// Delay time.<br>延时时间。
@property(nonatomic, assign) NSUInteger delay;
/// Video frameRate.<br>视频帧率。
@property(nonatomic, assign) NSUInteger frameRate;
/// Audio bitrate.<br>音频码率。
@property(nonatomic, assign) NSUInteger audioBitrate;
/// Video bitrate.<br>视频码率。
@property(nonatomic, assign) NSUInteger videoBitrate;
@end

/// Class IRTCQualityCriterion represents a scoring standard of network
/// connection
/// quality.<br>IRTCQualityCriterion代表了一个连接的网络质量的评分标准。
IRTC_OBJC_EXPORT
@interface IRTCQualityCriterion : NSObject
/// Percentage of packet loss rate scores. Values:
/// 0-1.<br>丢包率所占评分比例。取值可以是：0-1。
@property(nonatomic, assign) double packetloss;
@end

/// Class IRTCQualityReport represents quality report info of a network
/// connection.<br>IRTCQualityReport代表了网络连接的质量报告。
IRTC_OBJC_EXPORT
@interface IRTCQualityReport : NSObject
/// Status about a connection quality.<br>连接的质量状态。
@property(nonatomic, assign) IRTCQualityStatus status;
/// Quality about a connection. Values:
/// 0-100.<br>连接的质量分值。取值可以是：0-100。
@property(nonatomic, assign) NSUInteger quality;
/// Quality info of network connection.<br>连接的网络质量信息。
@property(nonatomic, strong) IRTCQualityInfo* info;
/// Quality criterion of network connection.<br>连网络质量的评分标准。
@property(nonatomic, strong) IRTCQualityCriterion* criterion;
@end

/// Status about remote stream connection.<br>远程流的连接状态。
///
/// This enumeration defines status of remote stream
/// connection.<br>此枚举类型定义了远程流的连接状态。
typedef NS_ENUM(NSInteger, IRTCConnectionState) {
  IRTCConnectionStateConnecting = 1,    ///< connecting<br>连接中
  IRTCConnectionStateConnected = 2,     ///< connected<br>已连接
  IRTCConnectionStateDisconnected = 3,  ///< disconnected<br>断开连接
};

/// Class ConnectionSummary represents summary of connection
/// quality.<br>ConnectionSummary代表了网络连接质量的统计。
IRTC_OBJC_EXPORT
@interface IRTCConnectionSummary : NSObject
/// Frozen percentage of frames.<br>画面卡顿比例。
@property(nonatomic, assign) NSUInteger frozenPercentage;
/// Average delay time.<br>平均延时时间。
@property(nonatomic, assign) NSUInteger averageDelay;
@end

NS_ASSUME_NONNULL_END
#endif  // IRTC_BASE_OBJC_IRTCMEDIAFORMAT_H_